-
-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom callback exception callable #7558
base: main
Are you sure you want to change the base?
Conversation
Can you add entries in CHANGELOG.md and doc/releases.md? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7558 +/- ##
===========================================
- Coverage 81.38% 41.63% -39.75%
===========================================
Files 340 329 -11
Lines 51487 49172 -2315
===========================================
- Hits 41902 20474 -21428
- Misses 9585 28698 +19113 ☔ View full report in Codecov by Sentry. |
f59003d
to
d7955cb
Compare
Is this a bug with param? panel/tests/chat/test_feed.py
Traceback (most recent call last):
File "/Users/ahuang/repos/panel/panel/tests/chat/test_feed.py", line 1134, in test_callback_exception_async_callable
chat_feed.callback_exception = exception_callback
File "/Users/ahuang/miniconda3/envs/panel/lib/python3.10/site-packages/param/parameterized.py", line 528, in _f
instance_param.__set__(obj, val)
File "/Users/ahuang/miniconda3/envs/panel/lib/python3.10/site-packages/param/parameterized.py", line 530, in _f
return f(self, obj, val)
File "/Users/ahuang/miniconda3/envs/panel/lib/python3.10/site-packages/param/parameterized.py", line 1476, in __set__
ref, deps, val, is_async = obj.param._resolve_ref(self, val)
File "/Users/ahuang/miniconda3/envs/panel/lib/python3.10/site-packages/param/parameterized.py", line 2044, in _resolve_ref
value = resolve_value(value, recursive=pobj.nested_refs)
File "/Users/ahuang/miniconda3/envs/panel/lib/python3.10/site-packages/param/parameterized.py", line 186, in resolve_value
value = eval_function_with_deps(value)
File "/Users/ahuang/miniconda3/envs/panel/lib/python3.10/site-packages/param/parameterized.py", line 165, in eval_function_with_deps
return function(*args, **kwargs)
TypeError: TestChatFeedCallback.test_callback_exception_async_callable.<locals>.exception_callback() missing 2 required positional arguments: 'exception' and 'instance' If it's sync, it raises so I added a ignore, but I don't think it should be ignored: ===================================================================================================== FAILURES =====================================================================================================
______________________________________________________________________________ TestChatFeedCallback.test_callback_exception_callable _______________________________________________________________________________
cls = <class '_pytest.runner.CallInfo'>, func = <function call_and_report.<locals>.<lambda> at 0x16a7067a0>, when = 'call', reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
) -> CallInfo[TResult]:
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:type func: Callable[[], _pytest.runner.TResult]
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: TResult | None = func()
../../miniconda3/envs/panel/lib/python3.10/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../miniconda3/envs/panel/lib/python3.10/site-packages/_pytest/runner.py:242: in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
../../miniconda3/envs/panel/lib/python3.10/site-packages/pluggy/_hooks.py:513: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
../../miniconda3/envs/panel/lib/python3.10/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
../../miniconda3/envs/panel/lib/python3.10/site-packages/_pytest/threadexception.py:92: in pytest_runtest_call
yield from thread_exception_runtest_hook()
../../miniconda3/envs/panel/lib/python3.10/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
yield
../../miniconda3/envs/panel/lib/python3.10/site-packages/_pytest/unraisableexception.py:95: in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def unraisable_exception_runtest_hook() -> Generator[None]:
with catch_unraisable_exception() as cm:
try:
yield
finally:
if cm.unraisable:
if cm.unraisable.err_msg is not None:
err_msg = cm.unraisable.err_msg
else:
err_msg = "Exception ignored in"
msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
msg += "".join(
traceback.format_exception(
cm.unraisable.exc_type,
cm.unraisable.exc_value,
cm.unraisable.exc_traceback,
)
)
> warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
E
E Traceback (most recent call last):
E File "/Users/ahuang/miniconda3/envs/panel/lib/python3.10/asyncio/base_events.py", line 773, in _call_soon
E handle = events.Handle(callback, args, self, context)
E ResourceWarning: unclosed <socket.socket fd=16, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
../../miniconda3/envs/panel/lib/python3.10/site-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning
============================================================================================= short test summary info ==============================================================================================
FAILED panel/tests/chat/test_feed.py::TestChatFeedCallback::test_callback_exception_callable - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0> |
Closes #6047